#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <string.h>
#include "dominion/dominion.h"
#include "dominion/dominion_helpers.h"
#include "dominion/rngs.h"
#include "dominion/interface.h"

/* testing feast card*/

int cardEffect(int card, int choice1, int choice2, int choice3, struct gameState *state, int handPos, int *bonus);

int main (int argc, char * argv[])
{
	/*modified from the initialization in the provided testUpdateCoins.c file */
    int seed = 1000;
    int numPlayer = 2;
    int k[10] = {adventurer, council_room, feast, gardens, mine
               , remodel, smithy, village, baron, great_hall};
	int r;
	int bonus = 0;
	
	/* test one -- to see if 1 card has been added to deck */
	struct gameState test_one;
    memset(&test_one, 23, sizeof(struct gameState));   // clear the game state
    r = initializeGame(numPlayer, k, seed, &test_one); // initialize a new game
	
	int deckcount = test_one.deckCount[0];
	
	cardEffect(feast, council_room, 0, 0, &test_one, 0, &bonus);
	
	if (test_one.deckCount[0] == deckcount + 1)
		printf("Feast test: PASS when testing to see if one card added to deck after calling Feast. \n");
	else
		printf("Feast test: PASS when testing to see if one card added to deck after calling Feast. \n");
	
	/* test two -- to see if an error is thrown if the card value is too high */
	struct gameState test_two;
    memset(&test_two, 23, sizeof(struct gameState));   // clear the game state
    r = initializeGame(numPlayer, k, seed, &test_two); // initialize a new game
	
	/*
	if ((cardEffect(feast, adventurer, 0, 0, &test_two, 0, &bonus)) == -1)
		printf("Feast test: PASS when testing to see if an error is thrown when the card value is too high. \n");
	else
		printf("Feast test: FAIL when testing to see if an error is thrown when the card value is too high. \n");
		*/
	/*
	
	^ 
	|
	|
	|
	|
	
	*/
	/******* the commented out test caused the program to crash. It is a bug in the program, but I cannot run the test
	in my suite of unit tests, because the following tests will not run after the crash. ********/
	printf("Feast test: FAIL when testing to see if an error is thrown when the card value is too high. \n");
	
	/* test three -- to see if an error is thrown if the supplycount of the card is 0 */
	struct gameState test_three;
    memset(&test_three, 23, sizeof(struct gameState));   // clear the game state
    r = initializeGame(numPlayer, k, seed, &test_three); // initialize a new game
	
	test_three.supplyCount[council_room] = 0;
	
	/*
	if ((cardEffect(feast, council_room, 0, 0, &test_three, 0, &bonus)) == -1)
		printf("Feast test: PASS when testing to see if an error is thrown when the card is out of supply. \n");
	else
		printf("Feast test: FAIL when testing to see if an error is thrown when the card is out of supply. \n");
	*/
	/*
	
		^ 
		|
		|
		|
		|
	
		*/
		/******* the commented out test caused the program to crash. It is a bug in the program, but I cannot run the test
		in my suite of unit tests, because the following tests will not run after the crash. ********/
	printf("Feast test: FAIL when testing to see if an error is thrown when the card is out of supply. \n");
	
	return 0;
}